﻿/*****************************************
 * 
 *  copyright (c) by ylshen
 * 
 *  author : ylshen (syl.lucky@gmail.com)
 * 
 **************************************** */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace JYStockAnalyser.ClientLib
{
    public class Tool
    {
        public static DialogResult ShowInformationBox(string message)
        {
            return MessageBox.Show(message, Configer.GetApplicationName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static DialogResult ShowQuestionBox(string message)
        {
            return MessageBox.Show(message, Configer.GetApplicationName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        public static string GetTheValueString(decimal va)
        {
            return va.Equals(JYStockAnalyser.Model.GuideLine.UNDEFINED_VALUE) ? "-" : va.ToString();
        }

        public static string[] GetEstimateValueStrings(decimal[] values)
        {
            if (values == null)
            {
                return new string[] { "-", "-", "-", "-", "-" };
            }
            string[] result = new string[5];

            result[0] = String.Format("低于{0}元", values[0]);
            result[1] = String.Format("{0}元 至 {1}元", values[0], values[1]);
            result[2] = String.Format("{0}元 至 {1}元", values[1] + 0.01m, values[3]);
            result[3] = String.Format("{0}元 至 {1}元", values[3] + 0.01m, values[4]);
            result[4] = String.Format("高于{0}元", values[4]);

            return result;
        }
    }
}
